package com.situ.crm.observer1;

import java.util.Observable;
import java.util.Observer;

public class Reader implements Observer {
    private String name;

    public Reader(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        //这是采用推的方式拿到数据
        System.out.println(name + "收到报纸，推送的内容是: " + arg);
        //这是拉去方式
        NewsPaper newsPaper = (NewsPaper)o;
        System.out.println(name + "收到报纸，拉取的内容是: " + newsPaper.getContent());
    }
}
